{% load utils_tags %}
{% load static %}
{% load pipeline %}
{% autoescape off %}
  <!DOCTYPE html>
  <html>
    <head>
      <title>
        {% block title %}NewsBlur{% endblock %}
      </title>
      <link rel="shortcut icon"
            href="{{ MEDIA_URL }}img/favicon.ico"
            type="image/png" />
      <link rel="icon" href="{{ MEDIA_URL }}img/favicon_32.png" sizes="32x32" />
      <link rel="icon" href="{{ MEDIA_URL }}img/favicon_64.png" sizes="64x64" />
      <link rel="apple-touch-icon"
            href="/media/img/mobile/apple-touch-icon-precomposed.png" />
      <meta http-equiv="Content-type" content="text/html; charset=utf-8">
      <meta name="msapplication-TileImage"
            content="{{ MEDIA_URL }}img/logo_144.png" />
      <meta name="msapplication-TileColor" content="#F7E5A8" />
      <meta name="apple-itunes-app" content="app-id=463981119">
      <link rel="manifest" href="/manifest.webmanifest">
      <!-- <link rel="mask-icon"
       href="{{ MEDIA_URL }}img/favicon_monochrome.svg"
       color="orange"> -->
      <script type="text/javascript" charset="utf-8">
    window.NEWSBLUR = {};
    NEWSBLUR.Globals = {
      'is_authenticated'        : {{ user.is_authenticated|yesno:"true,false" }},
      'is_anonymous'            : {{ user.is_anonymous|yesno:"true,false" }},
      'is_premium'              : {{ user_profile.is_premium|yesno:"true,false" }},
      'is_archive'              : {{ user_profile.is_archive|yesno:"true,false" }},
      'is_pro'                  : {{ user_profile.is_pro|yesno:"true,false" }},
      'is_admin'                : {{ user.is_staff|yesno:"true,false" }},
      'is_staff'                : {{ user.is_staff|yesno:"true,false" }},
      'premium_expire'          : {% if user_profile.premium_expire %}new Date('{{ user_profile.premium_expire|date:"Y-m-d" }}'){% else %}null{% endif %},
      'premium_renewal'         : {{ user_profile.premium_renewal|yesno:"true,false" }},
      'active_provider'         : {% if user_profile.active_provider %}"{{ user_profile.active_provider }}"{% else %}null{% endif %},
      'secret_token'            : "{{ user_profile.secret_token }}",
      'username'                : "{{ user.username|safe }}",
      {% if user.pk %}'user_id'                 : {{ user.pk }},{% endif %}
      'email'                   : "{{ user.email|safe }}",
      'MEDIA_URL'               : "{{ MEDIA_URL }}",
      'debug'                   : {{ debug|yesno:"true,false" }},
      'default_days_of_unread'  : {% settings_value "DAYS_OF_UNREAD" %}
    };
    NEWSBLUR.Flags = {
    };
    NEWSBLUR.Preferences = {
      'unread_view'             : 0,
      'lock_mouse_indicator'    : 300,
      'feed_pane_size'          : {% firstof user_profile.feed_pane_size 278 %},
      'hide_getting_started'    : {{ user_profile.hide_getting_started|yesno:"true,false" }},
      'has_setup_feeds'         : {{ user_profile.has_setup_feeds|yesno:"true,false" }},
      'has_found_friends'       : {{ user_profile.has_found_friends|yesno:"true,false" }},
      'has_trained_intelligence': {{ user_profile.has_trained_intelligence|yesno:"true,false" }},
      'story_titles_pane_size'  : 420,
      'story_pane_anchor'       : 'west',
      'new_window'              : 1,
      'default_view'            : 'feed',
      'default_order'           : 'newest',
      'default_read_filter'     : 'all',
      'default_stories_discover': 'feed',
      'default_dashboard_count' : 5,
      'grid_columns'            : 0,
      'grid_height'             : 'm',
      'hide_read_feeds'         : 0,
      'show_tooltips'           : 1,
      'show_contextmenus'       : 1,
      'notification_title_only' : 0,
      'feed_order'              : 'ALPHABETICAL',
      'keyboard_verticalarrows' : 'story',
      'keyboard_horizontalarrows': 'view',
      'space_scroll_spacing'    : 40,
      'arrow_scroll_spacing'    : 100,
      'space_bar_action'        : 'next_unread',
      'infrequent_stories_per_month': 30,
      'ssl'                     : 0,
      'open_feed_action'        : 'newest',
      'read_story_delay'        : 0,
      'feed_view_single_story'  : 0,
      'show_discover'           : true,
      'animations'              : true,
      'dateformat'              : "12",
      'folder_counts'           : false,
      'send_emails'             : {{ user_profile.send_emails|yesno:"true,false" }},
      'email_cc'                : true,
      'view_settings'           : {},
      'story_layout'            : 'split',
      'collapsed_folders'       : [],
      'story_styling'           : 'sans-serif',
      'feed_font'               : 'whitney',
      'feed_size'               : 'm',
      'story_size'              : 'm',
      'story_line_spacing'      : 'm',
      'hide_public_comments'    : false,
      'story_button_placement'  : "right",
      'days_of_unread'          : {% firstof user_profile.days_of_unread 30 %},
      'timezone'                : "{{ user_profile.timezone }}",
      'title_counts'            : true,
      'show_global_shared_stories': true,
      'show_infrequent_site_stories': true,
      'full_width_story'        : false,
      'story_position'          : 'center',
      'truncate_story'          : 'social',
      'autoopen_folder'         : false,
      'show_content_preview'    : true,
      'image_preview'           : 'small-left',
      'mark_read_on_scroll_titles' : false,
      'density'                 : 'comfortable',
      'doubleclick_feed'        : 'open',
      'doubleclick_unread'      : 'markread',
      'mark_read_river_confirm' : true,
      'markread_nextfeed'       : 'nextfeed',
      'story_share_twitter'     : true,
      'story_share_facebook'    : true,
      'story_share_copyurl'     : true,
      'story_share_copytext'    : true,
      'story_share_print'       : true,
      'story_share_email'       : true,
      'show_sideoption_email'   : true,
      'show_sideoption_save'    : true,
      'show_sideoption_train'   : true,
      'show_sideoption_share'   : true,
      'show_sideoption_related' : true,
      'theme'                   : 'auto',
      'highlights'              : true,
      'dashboard_columns'       : 2
    };
    NEWSBLUR.URLs = {
      'upload-avatar'           : "{% url "upload-avatar" %}",
      'opml-upload'             : "{% url "opml-upload" %}",
      'opml-export'             : "{% url "opml-export" %}",
      'domain'                  : "{% current_domain %}",
      'favicon'                 : "/rss_feeds/icon/{id}",
      'delete-account'          : "{% url "profile-delete-account" %}",
      'folder_rss'              : "/reader/folder_rss/{user_id}/{secret_token}/{unread_filter}/{folder_title}",
      'paypal_checkout_js'      : 'https://www.paypal.com/sdk/js?vault=true&intent=subscription&client-id={% settings_value "PAYPAL_API_CLIENTID" %}',
      'paypal_return'           : "https://{% current_domain %}{% url "paypal-return" %}",
      'paypal_archive_return'   : "https://{% current_domain %}{% url "paypal-archive-return" %}",
      'paypal_pro_return'        : "https://{% current_domain %}{% url "paypal-pro-return" %}"
    };
    NEWSBLUR.Models = {};
    NEWSBLUR.Collections = {};
    NEWSBLUR.Views = {};
    NEWSBLUR.app = {};
      </script>
      {% include_stylesheets "common" %}
      {% if debug_assets %}
        <link rel="stylesheet"
              type="text/css"
              href="https://cloud.typography.com/6565292/731824/css/fonts.css" />
      {% else %}
        <link rel="stylesheet"
              type="text/css"
              href="https://cloud.typography.com/6565292/711824/css/fonts.css" />
      {% endif %}
    </head>
    <body class="{% block bodyclass %}{% endblock %} {% if user.is_staff %}NB-staff{% endif %} {% if user_profile.is_premium %}NB-premium{% endif %}">
      {% block header %}{% endblock %}
      <div class="NB-body-inner">
        <div class="NB-splash-info NB-splash-top">
          <a href="{% url "index" %}">
            <div class="NB-splash-title NB-splash-blurred-logo"></div>
          </a>
        </div>
        {% block content %}{% endblock %}
        {% block footer %}
          {% render_footer "welcome" %}
        {% endblock footer %}
      </div>
      {% block head_js %}
        {% include_javascripts "common" %}
      {% endblock head_js %}
      <script type="text/javascript" charset="utf-8">
    _.extend(NEWSBLUR.Preferences, {% if user_profile.preferences %}{{ user_profile.preferences|safe }}{% else %}{}{% endif %});
    _.extend(NEWSBLUR.Preferences['view_settings'], {% if user_profile.view_settings %}{{ user_profile.view_settings|safe }}{% else %}{}{% endif %});
    _.extend(NEWSBLUR.Preferences['collapsed_folders'], {% if user_profile.collapsed_folders %}{{ user_profile.collapsed_folders|safe }}{% else %}[]{% endif %});
    
      </script>
      {% block extra_head_js %}
      {% endblock extra_head_js %}
    </body>
  </html>
{% endautoescape %}
